package main

import (
	//"database/sql"
	//_ "github.com/go-sql-driver/mysql"
	//"log"
	"fmt"
)

//注册表的
type RegistryData map[string]interface{}

type Registry struct {
	RegistryData
	isInit bool
}

func (self *Registry) Get(name string) interface{} {
	self.Init()
	err,value := self.RegistryData[name]
	if err != nil {
		return nil
	}
	return value
}

func (self *Registry) Set(name string, value interface{}) {
	self.Init()
  fmt.Println(self.RegistryData)
	self.RegistryData[name] = value
}

func (self Registry) Init() {
	if !self.isInit {
		self.RegistryData = make(RegistryData)
		self.isInit = true
	}
}

func main() {
	r := &Registry{isInit:false}

	r.Set("ttt", "good")

	good := r.Get("ttt")

	fmt.Println(good)
}
